package com.oedtech.esl.controller;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/menu")
public class MenuController {

    @RequestMapping("/user_manager")
    public String userManager(Model model){
        Authentication auth= SecurityContextHolder.getContext().getAuthentication();
        model.addAttribute("user",auth.getPrincipal());
        return "permission/user_manager";
    }

    @RequestMapping("/role_manager")
    public String roleManager(Model model){
        Authentication auth= SecurityContextHolder.getContext().getAuthentication();
        model.addAttribute("user",auth.getPrincipal());
        return "permission/role_manager";
    }

    @RequestMapping("/store_manager")
    public String storeManager(Model model){
        Authentication auth= SecurityContextHolder.getContext().getAuthentication();
        model.addAttribute("user",auth.getPrincipal());
        return "permission/store_manager";
    }
}
